<%-- 
    Document   : lottery
    Created on : Oct 14, 2011, 4:40:25 PM
    Author     : beryl
--%>

<%@ taglib prefix="s" uri="/struts-tags"%>
<div style="display: table-cell;"></div>
<table width="100%" class="mt10 bor-t-c" border="0">
    <tr class="user-tr">
        <td colspan="4">
            You currently have (<font style="color: red"><s:property value="userCurrentTicketCount"/></font>) tickets for the next draw. 
        </td>
    </tr>

    <s:if test="current_draw != null">
        <tr class="user-tr">
            <td>Next draw No. <s:property value="current_draw.drawid" />: </td>
            <td><s:date name="current_draw.drawdate"  format="dd/MM/yyyy HH:mm:ss"/></td>
            <td><button type="button" onclick="dojo.event.topic.publish('/buyTicket');">Buy Ticket (<s:property value="lotteryService.ticketPrice" /> pt) </button></td>
            <td>Prize: <s:property value="current_draw.prize" /></td>
        </tr> 
    </s:if>
    <s:else>
        <tr class="user-tr">
            <td>No lottery at the moment. </td>
        </tr> 
    </s:else>
    <s:iterator value="drawlist" begin="1">
        <tr class="user-tr">
            <td>Closed draw No. <s:property value="drawid" />: </td>
            <td><s:date name="drawdate" format="dd/MM/yyyy HH:mm:ss"/></td>
            <td>Winner: 
                <s:if test="winner != null">
                    <s:if test="winner.unikey==#session.user.unikey">
                        <font style="color: red">
                    </s:if>
                    <s:else>
                        <font style="color: green">
                    </s:else>
                    <s:property value="winner.name" />
                    </font>
                </s:if>
                <s:else><font style="color: blue">None</font></s:else>
            </td>
            <td>Prize: <s:property value="prize" /></td>
        </tr> 
    </s:iterator>
</table>
<script type="text/javascript">
    setTimer(<s:property value="timerCountDown+1" />);
    $("button").button().attr("autocomplete", "off");
    document.getElementById("cur_point").innerHTML=${session.user.points};
</script>